
package lumis.doui.upgrade;

import lumis.doui.DouiManagerFactory;
import lumis.portal.PortalException;
import lumis.portal.authentication.SessionConfig;
import lumis.upgrade.IStepHandler;
import lumis.util.ITransaction;
import lumis.util.XmlUtil;

import org.w3c.dom.Node;

/**
 * Unregister the specified control type. This step handler
 * definition must have a <code>controlType</code> element whose value is the type of the control being unregistred.
 * 
 * @since 4.0.6
 * @version $Revision: 4447 $ $Date: 2006-09-15 17:38:36 -0300 (Fri, 15 Sep 2006) $
 */
public class UnregisterControlTypeStepHandler implements IStepHandler
{

	public Node executeStep(SessionConfig sessionConfig, Node stepNode,	ITransaction transaction) throws PortalException
	{
		String controlType = XmlUtil.readNodeString("controlType", stepNode);
		if(controlType != null)
			DouiManagerFactory.getControlManager().unregisterControl(sessionConfig, controlType, transaction);
		// return success
		String stepResult = "<result><success></success></result>";
		Node resultNode = XmlUtil.getXMLDocumentFromString(stepResult);
		return resultNode;
	}

}
